#------------- User Settings -------------
visible O87P_USER = AUTO
visible SLP1_USER = AUTO
visible SLP2_USER = AUTO
visible PCT2_USER = AUTO #Do not set to 0, use OFF instead
visible PCT4_USER = AUTO #Do not set to 0, use OFF instead
visible CONA_USER = CONA #If CONA is not in event report, change to FALSE (for SLP1) or TRUE (for SLP2)
visible CONB_USER = CONB #If CONB is not in event report, change to FALSE (for SLP1) or TRUE (for SLP2)
visible CONC_USER = CONC #If CONC is not in event report, change to FALSE (for SLP1) or TRUE (for SLP2)
#----------- Definitions -----------
O87P = IF(O87P_USER = AUTO,O87P.SET,O87P_USER)
SLP1 = IF(SLP1_USER = AUTO,SLP1.SET,SLP1_USER)
SLP2 = IF(SLP2_USER = AUTO,SLP2.Set,SLP2_USER)
PCT2 = IF(PCT2.Set*1.0>0,(IF(PCT2_USER = AUTO,PCT2.Set*1.0,PCT2_USER)),OFF) #Set PCT2 to OFF if PCT2 = FALSE
PCT4 = IF(PCT4.Set*1.0>0,(IF(PCT4_USER = AUTO,PCT4.Set*1.0,PCT4_USER)),OFF) #Set PCT4 to OFF if PCT4 = FALSE
OFF = 9999
AUTO = 99999
#--- Standard Equation ---
SLP_A = IF(!CONA_USER,SLP1,SLP2) #Define active slope for Diff Element A
SLP_B = IF(!CONB_USER,SLP1,SLP2) #Define active slope for Diff Element B
SLP_C = IF(!CONC_USER,SLP1,SLP2) #Define active slope for Diff Element C
S_thresh_A = MAX(O87P,(SLP_A/100*IRTA)) #Standard threshold for Diff Element A
S_thresh_B = MAX(O87P,(SLP_B/100*IRTB)) #Standard threshold for Diff Element B
S_thresh_C = MAX(O87P,(SLP_C/100*IRTC)) #Standard threshold for Diff Element C
#--- Harmonic Restraint ---
HR_thresh_A = MAX(O87P,IF(PCT2=0,(SLP_A/100*IRTA),((SLP_A/100*IRTA)+(IAH2*IOPA/PCT2)+(IAH4*IOPA/PCT4)))) #Harmonic Restraint threshold for Diff Element A
HR_thresh_B = MAX(O87P,IF(PCT2=0,(SLP_B/100*IRTB),((SLP_B/100*IRTB)+(IBH2*IOPB/PCT2)+(IBH4*IOPB/PCT4)))) #Harmonic Restraint threshold for Diff Element B
HR_thresh_C = MAX(O87P,IF(PCT2=0,(SLP_C/100*IRTC),((SLP_C/100*IRTC)+(ICH2*IOPC/PCT2)+(ICH4*IOPC/PCT4)))) #Harmonic Restraint threshold for Diff Element C
#--- Harmonic Blocking ---
2H_A = IAH2 #2nd harmonics for Diff Element A, compare to PCT2
2H_B = IBH2 #2nd harmonics for Diff Element B, compare to PCT2
2H_C = ICH2 #2nd harmonics for Diff Element C, compare to PCT2
4H_A = IAH4 #4th harmonics for Diff Element A, compare to PCT4
4H_B = IBH4 #4th harmonics for Diff Element B, compare to PCT4
4H_C = ICH4 #4th harmonics for Diff Element C, compare to PCT4
IOP_min = 0.05 #Minimum operate threshold required for Harmonic Blocking